function Target(x, y, d) {
	
	// position.
	this.px = x;
	this.py = y;
	
	// diameter.
	this.diameter = d;

	// is this object satisfied for completing this level?
	this.satisfied = false;
	this.stickyWin = false;

	// render function for this mirror.
	Target.prototype.render = function(processing) {
		if (this.satisfied) {
			processing.fill(0, 255, 0);
		} else {
			processing.fill(255, 0, 0);
		}
		processing.ellipse(this.px, this.py, this.diameter, this.diameter);
	}	
	
	Target.prototype.collides = function(x, y) {
		distance = Math.sqrt((x - this.px) * (x - this.px)) + ((y - this.py) * (y - this.py));
		return distance < (this.diameter / 2.0);
	}

	Target.prototype.processMouse = function(x, y) {
	  if (!this.stickyWin) {
	    this.stickyWin = this.collides(x, y);
	  }
	  if (this.stickyWin) {
	    this.satisfied = true;
	  }
	}
	
	Target.prototype.reset = function(x, y) {
	  if (!this.stickyWin)
	    this.satisfied = false;
	}

	Target.prototype.emitsLaser = function() {
	  return false;
	}

	Target.prototype.update = function() {
	}

	Target.prototype.sign = function(x) {
	  if (x < 0) {
	    return -1;
	  }
	  return 1;
	}

	Target.prototype.getInterruptDistance = function(vectorX, vectorY, vectorAngle) {
	  var x1 = vectorX - this.px;
	  var x2 = x1 + Math.cos(Math.PI * vectorAngle / 180.0);
	  var y1 = vectorY - this.py;
	  var y2 = y1 + Math.sin(Math.PI * vectorAngle / 180.0);
	  var D = x1 * y2 - x2 * y1;
	  var distSquared = (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2);
	  var radius = this.diameter / 2.0;
	  var discriminant = radius * radius * distSquared - D * D;
	  if (discriminant < 0) {
	    return -1;
	  }
	  // Check if the circle is in the right direction from the laser.
	  if (this.sign(x2 - x1) != this.sign(0 - x1)) {
	    return -1;
	  }
	  if (this.sign(y2 - y1) != this.sign(0 - y1)) {
	    return -1;
	  }
	  // Approximate distance as dist to center of circle because that's close enough.
	  return Math.sqrt(x1 * x1 + y1 * y1);
	}

	Target.prototype.handleLaser = function() {
	  this.satisfied = true;
	}
}
